<html>
<head><meta charset="utf-8"><title>Running trait resolution in rustc plugin · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Running.20trait.20resolution.20in.20rustc.20plugin.html">Running trait resolution in rustc plugin</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246856174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Running%20trait%20resolution%20in%20rustc%20plugin/near/246856174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Running.20trait.20resolution.20in.20rustc.20plugin.html#246856174">(Jul 22 2021 at 14:40)</a>:</h4>
<p>Does anyone have a good example of how to run trait resolution inside of a Rustc plugin (in particular when we've already arrived to the MIR stage)? What should the entry point be? <code>type_implements_trait</code>? <code>predicate_may_hold</code>?</p>



<a name="246856474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Running%20trait%20resolution%20in%20rustc%20plugin/near/246856474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Running.20trait.20resolution.20in.20rustc.20plugin.html#246856474">(Jul 22 2021 at 14:42)</a>:</h4>
<p><code>evaluate_obligation</code> maybe? Not familiar with this area of rustc though.</p>



<a name="246856608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Running%20trait%20resolution%20in%20rustc%20plugin/near/246856608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Xavier Denis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Running.20trait.20resolution.20in.20rustc.20plugin.html#246856608">(Jul 22 2021 at 14:43)</a>:</h4>
<p>the only documentation on that says:</p>
<blockquote>
<p>Do not call this query directly: invoke infcx.predicate_may_hold() or infcx.predicate_must_hold() instead.</p>
</blockquote>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>